package com.mxx.common.data.domain.entity;

import com.mxx.common.data.domain.IdType;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

/**
 * @Auther: Mr. Zeng
 * @Date: 2020/6/28 13:12
 * @Description: 暂无描述
 */
@Data
@Accessors(chain = true)
@DynamicInsert
@DynamicUpdate
@MappedSuperclass
public class StringSnowflakeId extends com.mxx.common.data.domain.entity.Id<String> {

    @Id
    @GeneratedValue(generator = "snowflakeStringIdGenerate")
    @GenericGenerator(name = "snowflakeStringIdGenerate", strategy = IdType.SNOW_FLAKE_STRING)
    @Column(name = "id", columnDefinition = "varchar(20) NOT NULL COMMENT 'ID'")
    /**
     * id
     * @Ignore
     */
    private String id;

    public String getId() {
        return this.id;
    }
}
